local skel = fk.CreateSkill {
  name = "emo__haixian",
}

Fk:loadTranslationTable{
  ["emo__haixian"] = "海鲜相煎",
  [":emo__haixian"] = "每回合限一次，你可以将至少一张牌置于牌堆顶以视为使用【树上开花】。",
  ["#emo__haixian"] = "海鲜相煎:将至少一张牌置于牌堆顶，视为使用【树上开花】",
}

skel:addEffect("viewas", {
  anim_type = "drawcard",
  pattern = "bogus_flower",
  prompt = "#emo__haixian",
  filter_pattern = {
    min_num = 0,
    max_num = 0,
    pattern = "",
    subcards = {}
  },
  card_filter = Util.TrueFunc,
  view_as = function(self, player, cards)
    if #cards == 0 then return end
    local card = Fk:cloneCard("bogus_flower")
    card.skillName = skel.name
    card:addFakeSubcards(cards)
    return card
  end,
  before_use = function (self, player, use)
    local cards = use.card.fake_subcards
    if #cards == 0 then return "" end
    if #cards > 1 then
      cards = player.room:askToGuanxing(player, {
        cards = cards, bottom_limit = {0, 0}, skill_name = skel.name, skip = true
      }).top
    end
    player.room:moveCards({
      ids = table.reverse(cards),
      from = player,
      toArea = Card.DrawPile,
      moveReason = fk.ReasonPut,
      skillName = skel.name,
      proposer = player,
      moveVisible = false,
    })
  end,
  enabled_at_play = function(self, player)
    return player:usedSkillTimes(skel.name) == 0
  end,
  enabled_at_response = function (self, player, response)
    if not response then
      return player:usedSkillTimes(skel.name) == 0
    end
  end,
})

return skel
